export default {
  data() {
      return {
          // 默认的全局分享内容
          share: {
              title: '百蜂荟，等你来玩！！！',
              path: '/pages/home/index',    // 全局分享的路径
              imageUrl: '../../static/logo.png',    // 全局分享的图片(可本地可网络)
          }
      }
  },
  // 定义全局分享
  // 1.发送给朋友
  onShareAppMessage(res) {
	  let _data = this._data
	  if (res.from === 'button') {
		  switch (this.$mp.page.$page.fullPath.split('?')[0]){
		  	case '/pages/activity/mien':
			console.log(this.shareShowId,"分享到朋友圈")
			let userid = res.target.dataset.userid
			let seek = ''
				for(let i=0;i<_data.mienList.length;i++){
					if(userid==_data.mienList[i].userId){
						seek = _data.mienList[i]
					}
				}
				return {
					title: seek.showText,
					path: '/subPackages/activity/mienDetailed?showId='+this.shareShowId ,
					imageUrl: seek.showFile[0],
				}
			case "/subPackages/activity/detail":
				let username = _data.username
				let activityname = _data.activity.name
				let img = _data.activity.activityImg
				this.share.imageUrl = img
				return {
					title: username?username+"邀请你"+activityname:activityname,
					path: this.$mp.page.$page.fullPath,
					imageUrl: this.share.imageUrl,
				}
		  	default:
		  		break;
		  }

	  } else{
		  switch (this.$mp.page.$page.fullPath.split('?')[0]){
		  	case '/pages/activity/mien':
			console.log(this,"分享风采")
			return {
			    title: "我发布了风采，快来看看",
			    path: this.$mp.page.$page.fullPath,
			    imageUrl: this.share.imageUrl,
			}
			case '/subPackages/activity/detail':
			let username = _data.username
			let activityname = _data.activity.activityDesignation
			let img = _data.activity.activityImg
			this.share.imageUrl = img
			return {
				title: username?username+"邀请你"+activityname:activityname,
				path: this.$mp.page.$page.fullPath,
				imageUrl: this.share.imageUrl,
			}
		  	default:
				return {
					title:"邀请你使用百蜂荟",
					path: this.$mp.page.$page.fullPath,
					imageUrl: this.share.imageUrl,
				}
		  }
	  	
	  }
      
  },
  //2.分享到朋友圈
  onShareTimeline(res) {
	  console.log(res)
	  console.log(this._data)
	  let _data = this._data
	  switch (this.$mp.page.$page.fullPath.split('?')[0]){
	  	case '/pages/activity/detail':
	  	let username = _data.username
	  	let activityname = _data.activity.activityDesignation
	  	let img = _data.activity.activityImg
	  	this.share.imageUrl = img
	  	return {
	  		title: username?username+"邀请你"+activityname:activityname,
	  		path: this.$mp.page.$page.fullPath,
	  		imageUrl: this.share.imageUrl,
	  	}
	  	default:
	  		return {
	  		    title: '邀请你使用百蜂荟',
	  		    path: this.$mp.page.$page.fullPath,
	  		    imageUrl: this.share.imageUrl,
	  		}
	  }

  },
}